package com.chat.bean;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

//Serializable 序列化接口
public class News implements Serializable {

    private int id;
    private String name;
    private String type;
    private byte[] data;

    public News() {

    }

    public News(int id, String name, String type, byte[] data){

        this.id = id;
        this.name = name;
        this.type = type;
        this.data = data;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    @Override
    public String toString() {

        String s = null;
        try {
            s = new String(data, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }


        return "News{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type=" + type +
                ", data='" + s + '\'' +
                '}';

    }
}
